home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Technology Seed / August 1998 ADC Seed CD.toast / Mac OS 8.5b2 / allegro-b2-pseudo-SDK / CIncludes / Menus.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-17  |  25.6 KB  |  812 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Menus.h
  3.  
  4.      Contains:    Menu Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Allego Seed, Use with 3.1 Universal Interfaces
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __MENUS__
  19. #define __MENUS__
  20.  
  21. #ifndef __APPLEEVENTS__
  22. #include <AppleEvents.h>
  23. #endif
  24. #ifndef __CONDITIONALMACROS__
  25. #include <ConditionalMacros.h>
  26. #endif
  27. #ifndef __EVENTS__
  28. #include <Events.h>
  29. #endif
  30. #ifndef __PROCESSES__
  31. #include <Processes.h>
  32. #endif
  33. #ifndef __TEXTCOMMON__
  34. #include <TextCommon.h>
  35. #endif
  36. #ifndef __MACTYPES__
  37. #include <MacTypes.h>
  38. #endif
  39. #ifndef __QUICKDRAW__
  40. #include <Quickdraw.h>
  41. #endif
  42.  
  43.  
  44.  
  45. #if PRAGMA_ONCE
  46. #pragma once
  47. #endif
  48.  
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52.  
  53. #if PRAGMA_IMPORT
  54. #pragma import on
  55. #endif
  56.  
  57. #if PRAGMA_STRUCT_ALIGN
  58.     #pragma options align=mac68k
  59. #elif PRAGMA_STRUCT_PACKPUSH
  60.     #pragma pack(push, 2)
  61. #elif PRAGMA_STRUCT_PACK
  62.     #pragma pack(2)
  63. #endif
  64.  
  65. /*——————————————————————————————————————————————————————————————————————————————————————*/
  66. /*    • Gestalt                                                                            */
  67. /*——————————————————————————————————————————————————————————————————————————————————————*/
  68.  
  69. enum {
  70.     gestaltMenuMgrAttr            = FOUR_CHAR_CODE('menu'),        /* If this Gestalt exists, the PowerPC-native Menu Manager is installed*/
  71.     gestaltMenuMgrPresent        = 1
  72. };
  73.  
  74.  
  75. enum {
  76.     menuPropertyInvalid            = -5603,
  77.     menuPropertyNotFoundErr        = -5604
  78. };
  79.  
  80. /*——————————————————————————————————————————————————————————————————————————————————————*/
  81. /*    • Menu Types (for Appearance 1.0 and later)                                            */
  82. /*——————————————————————————————————————————————————————————————————————————————————————*/
  83.  
  84. enum {
  85.     kMenuStdMenuProc            = 63,
  86.     kMenuStdMenuBarProc            = 63
  87. };
  88.  
  89.  
  90. enum {
  91.     kMenuNoModifiers            = 0,                            /* Mask for no modifiers*/
  92.     kMenuShiftModifier            = (1 << 0),                        /* Mask for shift key modifier*/
  93.     kMenuOptionModifier            = (1 << 1),                        /* Mask for option key modifier*/
  94.     kMenuControlModifier        = (1 << 2),                        /* Mask for control key modifier*/
  95.     kMenuNoCommandModifier        = (1 << 3)                        /* Mask for no command key modifier*/
  96. };
  97.  
  98.  
  99. enum {
  100.     kMenuNoIcon                    = 0,                            /* No icon*/
  101.     kMenuIconType                = 1,                            /* Type for ICON*/
  102.     kMenuShrinkIconType            = 2,                            /* Type for ICON plotted 16 x 16*/
  103.     kMenuSmallIconType            = 3,                            /* Type for SICN*/
  104.     kMenuColorIconType            = 4,                            /* Type for cicn*/
  105.     kMenuIconSuiteType            = 5,                            /* Type for Icon Suite*/
  106.     kMenuIconRefType            = 6                                /* Type for Icon Ref*/
  107. };
  108.  
  109. /* —— end of Appearance 1.0 types*/
  110.  
  111.  
  112. enum {
  113.     noMark                        = 0                                /*mark symbol for MarkItem*/
  114. };
  115.  
  116.  
  117. enum {
  118.                                                                 /* menu defProc messages */
  119.     kMenuDrawMsg                = 0,
  120.     kMenuChooseMsg                = 1,
  121.     kMenuSizeMsg                = 2,
  122.     kMenuDrawItemMsg            = 4,
  123.     kMenuCalcItemMsg            = 5,
  124.     kMenuThemeSavvyMsg            = 7,                            /* is your MDEF theme-savvy?  If so, return hex 7473 in the whichItem parameter*/
  125.     mDrawMsg                    = 0,
  126.     mChooseMsg                    = 1,
  127.     mSizeMsg                    = 2,
  128.     mDrawItemMsg                = 4,
  129.     mCalcItemMsg                = 5
  130. };
  131.  
  132.  
  133. enum {
  134.     kThemeSavvyMenuResponse        = 0x7473
  135. };
  136.  
  137.  
  138. enum {
  139.     textMenuProc                = 0,
  140.     hMenuCmd                    = 27,                            /*itemCmd == 0x001B ==> hierarchical menu*/
  141.     hierMenu                    = -1,                            /*a hierarchical menu - for InsertMenu call*/
  142.     mPopUpMsg                    = 3,                            /*menu defProc messages - place yourself*/
  143.     mctAllItems                    = -98,                            /*search for all Items for the given ID*/
  144.     mctLastIDIndic                = -99                            /*last color table entry has this in ID field*/
  145. };
  146.  
  147.  
  148.  
  149. struct MenuInfo {
  150.     short                             menuID;
  151.     short                             menuWidth;
  152.     short                             menuHeight;
  153.     Handle                             menuProc;
  154.     long                             enableFlags;
  155.     Str255                             menuData;
  156. };
  157. typedef struct MenuInfo                    MenuInfo;
  158.  
  159. typedef MenuInfo *                        MenuPtr;
  160. typedef MenuPtr *                        MenuHandle;
  161. /* MenuRef is obsolete.  Use MenuHandle. */
  162. typedef MenuHandle                         MenuRef;
  163.  
  164. struct MCEntry {
  165.     short                             mctID;                        /*menu ID.  ID = 0 is the menu bar*/
  166.     short                             mctItem;                    /*menu Item. Item = 0 is a title*/
  167.     RGBColor                         mctRGB1;                    /*usage depends on ID and Item*/
  168.     RGBColor                         mctRGB2;                    /*usage depends on ID and Item*/
  169.     RGBColor                         mctRGB3;                    /*usage depends on ID and Item*/
  170.     RGBColor                         mctRGB4;                    /*usage depends on ID and Item*/
  171.     short                             mctReserved;                /*reserved for internal use*/
  172. };
  173. typedef struct MCEntry                    MCEntry;
  174. typedef MCEntry *                        MCEntryPtr;
  175.  
  176. typedef MCEntry                         MCTable[1];
  177. typedef MCEntry *                        MCTablePtr;
  178. typedef MCTablePtr *                    MCTableHandle;
  179.  
  180. struct MenuCRsrc {
  181.     short                             numEntries;                    /*number of entries*/
  182.     MCTable                         mcEntryRecs;                /*ARRAY [1..numEntries] of MCEntry*/
  183. };
  184. typedef struct MenuCRsrc                MenuCRsrc;
  185. typedef MenuCRsrc *                        MenuCRsrcPtr;
  186. typedef MenuCRsrcPtr *                    MenuCRsrcHandle;
  187. #if TARGET_OS_WIN32
  188. /* QuickTime 3.0 */
  189.  
  190. struct MenuAccessKeyRec {
  191.     short                             count;
  192.     long                             flags;
  193.     unsigned char                     keys[1];
  194. };
  195. typedef struct MenuAccessKeyRec            MenuAccessKeyRec;
  196.  
  197. typedef MenuAccessKeyRec *                MenuAccessKeyPtr;
  198. typedef MenuAccessKeyPtr *                MenuAccessKeyHandle;
  199. EXTERN_API_C( void )
  200. SetMenuItemHotKey                (MenuHandle             menu,
  201.                                  short                     itemID,
  202.                                  char                     hotKey,
  203.                                  long                     flags);
  204.  
  205. #endif  /* TARGET_OS_WIN32 */
  206.  
  207. typedef CALLBACK_API( void , MenuDefProcPtr )(short message, MenuHandle theMenu, Rect *menuRect, Point hitPt, short *whichItem);
  208. typedef CALLBACK_API( long , MenuBarDefProcPtr )(short selector, short message, short parameter1, long parameter2);
  209. typedef CALLBACK_API( void , MenuHookProcPtr )(void );
  210. typedef CALLBACK_API( short , MBarHookProcPtr )(Rect *menuRect);
  211. /*
  212.     WARNING: MBarHookProcPtr uses register based parameters under classic 68k
  213.              and cannot be written in a high-level language without 
  214.              the help of mixed mode or assembly glue.
  215. */
  216. typedef STACK_UPP_TYPE(MenuDefProcPtr)                             MenuDefUPP;
  217. typedef STACK_UPP_TYPE(MenuBarDefProcPtr)                         MenuBarDefUPP;
  218. typedef STACK_UPP_TYPE(MenuHookProcPtr)                         MenuHookUPP;
  219. typedef REGISTER_UPP_TYPE(MBarHookProcPtr)                         MBarHookUPP;
  220. enum { uppMenuDefProcInfo = 0x0000FF80 };                         /* pascal no_return_value Func(2_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  221. enum { uppMenuBarDefProcInfo = 0x00003AB0 };                     /* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 4_bytes) */
  222. enum { uppMenuHookProcInfo = 0x00000000 };                         /* pascal no_return_value Func() */
  223. enum { uppMBarHookProcInfo = 0x000000CF };                         /* SPECIAL_CASE_PROCINFO(12) */
  224. #define NewMenuDefProc(userRoutine)                             (MenuDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuDefProcInfo, GetCurrentArchitecture())
  225. #define NewMenuBarDefProc(userRoutine)                             (MenuBarDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuBarDefProcInfo, GetCurrentArchitecture())
  226. #define NewMenuHookProc(userRoutine)                             (MenuHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuHookProcInfo, GetCurrentArchitecture())
  227. #define NewMBarHookProc(userRoutine)                             (MBarHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMBarHookProcInfo, GetCurrentArchitecture())
  228. #define CallMenuDefProc(userRoutine, message, theMenu, menuRect, hitPt, whichItem)  CALL_FIVE_PARAMETER_UPP((userRoutine), uppMenuDefProcInfo, (message), (theMenu), (menuRect), (hitPt), (whichItem))
  229. #define CallMenuBarDefProc(userRoutine, selector, message, parameter1, parameter2)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppMenuBarDefProcInfo, (selector), (message), (parameter1), (parameter2))
  230. #define CallMenuHookProc(userRoutine)                             CALL_ZERO_PARAMETER_UPP((userRoutine), uppMenuHookProcInfo)
  231. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  232.     /* CallMBarHookProc can't be called from classic 68k without glue code */
  233. #else
  234.     #define CallMBarHookProc(userRoutine, menuRect)             CALL_ONE_PARAMETER_UPP((userRoutine), uppMBarHookProcInfo, (menuRect))
  235. #endif
  236.  
  237. EXTERN_API( short )
  238. GetMBarHeight                    (void)                                                        TWOWORDINLINE(0x3EB8, 0x0BAA);
  239.  
  240. EXTERN_API( void )
  241. InitMenus                        (void)                                                        ONEWORDINLINE(0xA930);
  242.  
  243. EXTERN_API( MenuHandle )
  244. NewMenu                            (short                     menuID,
  245.                                  ConstStr255Param         menuTitle)                            ONEWORDINLINE(0xA931);
  246.  
  247. #if TARGET_OS_MAC
  248.     #define MacGetMenu GetMenu
  249. #endif
  250. EXTERN_API( MenuHandle )
  251. MacGetMenu                        (short                     resourceID)                            ONEWORDINLINE(0xA9BF);
  252.  
  253. EXTERN_API( void )
  254. DisposeMenu                        (MenuHandle             theMenu)                            ONEWORDINLINE(0xA932);
  255.  
  256. #if TARGET_OS_MAC
  257.     #define MacAppendMenu AppendMenu
  258. #endif
  259. EXTERN_API( void )
  260. MacAppendMenu                    (MenuHandle             menu,
  261.                                  ConstStr255Param         data)                                ONEWORDINLINE(0xA933);
  262.  
  263. EXTERN_API( void )
  264. InsertResMenu                    (MenuHandle             theMenu,
  265.                                  ResType                 theType,
  266.                                  short                     afterItem)                            ONEWORDINLINE(0xA951);
  267.  
  268. #if TARGET_OS_MAC
  269.     #define MacInsertMenu InsertMenu
  270. #endif
  271. EXTERN_API( void )
  272. MacInsertMenu                    (MenuHandle             theMenu,
  273.                                  short                     beforeID)                            ONEWORDINLINE(0xA935);
  274.  
  275. #if TARGET_OS_MAC
  276.     #define MacDeleteMenu DeleteMenu
  277. #endif
  278. EXTERN_API( void )
  279. MacDeleteMenu                    (short                     menuID)                                ONEWORDINLINE(0xA936);
  280.  
  281. EXTERN_API( void )
  282. AppendResMenu                    (MenuHandle             theMenu,
  283.                                  ResType                 theType)                            ONEWORDINLINE(0xA94D);
  284.  
  285. #if TARGET_OS_MAC
  286.     #define MacInsertMenuItem InsertMenuItem
  287. #endif
  288. EXTERN_API( void )
  289. MacInsertMenuItem                (MenuHandle             theMenu,
  290.                                  ConstStr255Param         itemString,
  291.                                  short                     afterItem)                            ONEWORDINLINE(0xA826);
  292.  
  293. EXTERN_API( void )
  294. DeleteMenuItem                    (MenuHandle             theMenu,
  295.                                  short                     item)                                ONEWORDINLINE(0xA952);
  296.  
  297. EXTERN_API( long )
  298. MenuKey                            (CharParameter             ch)                                    ONEWORDINLINE(0xA93E);
  299.  
  300. EXTERN_API( void )
  301. HiliteMenu                        (short                     menuID)                                ONEWORDINLINE(0xA938);
  302.  
  303. EXTERN_API( void )
  304. SetMenuItemText                    (MenuHandle             theMenu,
  305.                                  short                     item,
  306.                                  ConstStr255Param         itemString)                            ONEWORDINLINE(0xA947);
  307.  
  308. EXTERN_API( void )
  309. GetMenuItemText                    (MenuHandle             theMenu,
  310.                                  short                     item,
  311.                                  Str255                 itemString)                            ONEWORDINLINE(0xA946);
  312.  
  313. EXTERN_API( void )
  314. SetItemMark                        (MenuHandle             theMenu,
  315.                                  short                     item,
  316.                                  CharParameter             markChar)                            ONEWORDINLINE(0xA944);
  317.  
  318. EXTERN_API( void )
  319. GetItemMark                        (MenuHandle             theMenu,
  320.                                  short                     item,
  321.                                  CharParameter *        markChar)                            ONEWORDINLINE(0xA943);
  322.  
  323. EXTERN_API( void )
  324. SetItemCmd                        (MenuHandle             theMenu,
  325.                                  short                     item,
  326.                                  CharParameter             cmdChar)                            ONEWORDINLINE(0xA84F);
  327.  
  328. EXTERN_API( void )
  329. GetItemCmd                        (MenuHandle             theMenu,
  330.                                  short                     item,
  331.                                  CharParameter *        cmdChar)                            ONEWORDINLINE(0xA84E);
  332.  
  333. EXTERN_API( void )
  334. SetItemIcon                        (MenuHandle             theMenu,
  335.                                  short                     item,
  336.                                  short                     iconIndex)                            ONEWORDINLINE(0xA940);
  337.  
  338. EXTERN_API( void )
  339. GetItemIcon                        (MenuHandle             theMenu,
  340.                                  short                     item,
  341.                                  short *                iconIndex)                            ONEWORDINLINE(0xA93F);
  342.  
  343. EXTERN_API( void )
  344. SetItemStyle                    (MenuHandle             theMenu,
  345.                                  short                     item,
  346.                                  StyleParameter         chStyle)                            ONEWORDINLINE(0xA942);
  347.  
  348. EXTERN_API( void )
  349. GetItemStyle                    (MenuHandle             theMenu,
  350.                                  short                     item,
  351.                                  Style *                chStyle);
  352.  
  353. EXTERN_API( MenuHandle )
  354. GetMenuHandle                    (short                     menuID)                                ONEWORDINLINE(0xA949);
  355.  
  356. EXTERN_API( void )
  357. CalcMenuSize                    (MenuHandle             theMenu)                            ONEWORDINLINE(0xA948);
  358.  
  359. EXTERN_API( void )
  360. DisableItem                        (MenuHandle             theMenu,
  361.                                  short                     item)                                ONEWORDINLINE(0xA93A);
  362.  
  363. EXTERN_API( void )
  364. EnableItem                        (MenuHandle             theMenu,
  365.                                  short                     item)                                ONEWORDINLINE(0xA939);
  366.  
  367. EXTERN_API( void )
  368. FlashMenuBar                    (short                     menuID)                                ONEWORDINLINE(0xA94C);
  369.  
  370. EXTERN_API( long )
  371. PopUpMenuSelect                    (MenuHandle             menu,
  372.                                  short                     top,
  373.                                  short                     left,
  374.                                  short                     popUpItem)                            ONEWORDINLINE(0xA80B);
  375.  
  376. EXTERN_API( long )
  377. MenuChoice                        (void)                                                        ONEWORDINLINE(0xAA66);
  378.  
  379. EXTERN_API( void )
  380. DeleteMCEntries                    (short                     menuID,
  381.                                  short                     menuItem)                            ONEWORDINLINE(0xAA60);
  382.  
  383. EXTERN_API( MCTableHandle )
  384. GetMCInfo                        (void)                                                        ONEWORDINLINE(0xAA61);
  385.  
  386. EXTERN_API( void )
  387. SetMCInfo                        (MCTableHandle             menuCTbl)                            ONEWORDINLINE(0xAA62);
  388.  
  389. EXTERN_API( void )
  390. DisposeMCInfo                    (MCTableHandle             menuCTbl)                            ONEWORDINLINE(0xAA63);
  391.  
  392. EXTERN_API( MCEntryPtr )
  393. GetMCEntry                        (short                     menuID,
  394.                                  short                     menuItem)                            ONEWORDINLINE(0xAA64);
  395.  
  396. EXTERN_API( void )
  397. SetMCEntries                    (short                     numEntries,
  398.                                  MCTablePtr             menuCEntries)                        ONEWORDINLINE(0xAA65);
  399.  
  400. #if TARGET_OS_MAC
  401.     #define MacDrawMenuBar DrawMenuBar
  402. #endif
  403. EXTERN_API( void )
  404. MacDrawMenuBar                    (void)                                                        ONEWORDINLINE(0xA937);
  405.  
  406. EXTERN_API( void )
  407. InvalMenuBar                    (void)                                                        ONEWORDINLINE(0xA81D);
  408.  
  409. EXTERN_API( void )
  410. InitProcMenu                    (short                     resID)                                ONEWORDINLINE(0xA808);
  411.  
  412. EXTERN_API( Handle )
  413. GetMenuBar                        (void)                                                        ONEWORDINLINE(0xA93B);
  414.  
  415. EXTERN_API( void )
  416. SetMenuBar                        (Handle                 menuList)                            ONEWORDINLINE(0xA93C);
  417.  
  418. EXTERN_API( Boolean )
  419. SystemEdit                        (short                     editCmd)                            ONEWORDINLINE(0xA9C2);
  420.  
  421. EXTERN_API( void )
  422. SystemMenu                        (long                     menuResult)                            ONEWORDINLINE(0xA9B5);
  423.  
  424. EXTERN_API( Handle )
  425. GetNewMBar                        (short                     menuBarID)                            ONEWORDINLINE(0xA9C0);
  426.  
  427. EXTERN_API( void )
  428. ClearMenuBar                    (void)                                                        ONEWORDINLINE(0xA934);
  429.  
  430. EXTERN_API( void )
  431. CheckItem                        (MenuHandle             theMenu,
  432.                                  short                     item,
  433.                                  Boolean                 checked)                            ONEWORDINLINE(0xA945);
  434.  
  435. EXTERN_API( short )
  436. CountMItems                        (MenuHandle             theMenu)                            ONEWORDINLINE(0xA950);
  437.  
  438. EXTERN_API( void )
  439. SetMenuFlash                    (short                     count)                                ONEWORDINLINE(0xA94A);
  440.  
  441. EXTERN_API( long )
  442. MenuSelect                        (Point                     startPt)                            ONEWORDINLINE(0xA93D);
  443.  
  444. EXTERN_API( void )
  445. InsertFontResMenu                (MenuHandle             theMenu,
  446.                                  short                     afterItem,
  447.                                  short                     scriptFilter)                        THREEWORDINLINE(0x303C, 0x0400, 0xA825);
  448.  
  449. EXTERN_API( void )
  450. InsertIntlResMenu                (MenuHandle             theMenu,
  451.                                  ResType                 theType,
  452.                                  short                     afterItem,
  453.                                  short                     scriptFilter)                        THREEWORDINLINE(0x303C, 0x0601, 0xA825);
  454.  
  455.  
  456. /*——————————————————————————————————————————————————————————————————————————————————————*/
  457. /*    • Appearance 1.0 and later Menu Manager routines                                    */
  458. /*——————————————————————————————————————————————————————————————————————————————————————*/
  459. EXTERN_API( UInt32 )
  460. MenuEvent                        (const EventRecord *    inEvent)                            THREEWORDINLINE(0x303C, 0x020C, 0xA825);
  461.  
  462. EXTERN_API( OSErr )
  463. SetMenuItemCommandID            (MenuHandle             inMenu,
  464.                                  SInt16                 inItem,
  465.                                  UInt32                 inCommandID)                        THREEWORDINLINE(0x303C, 0x0502, 0xA825);
  466.  
  467. EXTERN_API( OSErr )
  468. GetMenuItemCommandID            (MenuHandle             inMenu,
  469.                                  SInt16                 inItem,
  470.                                  UInt32 *                outCommandID)                        THREEWORDINLINE(0x303C, 0x0503, 0xA825);
  471.  
  472. EXTERN_API( OSErr )
  473. SetMenuItemModifiers            (MenuHandle             inMenu,
  474.                                  SInt16                 inItem,
  475.                                  UInt8                     inModifiers)                        THREEWORDINLINE(0x303C, 0x0404, 0xA825);
  476.  
  477. EXTERN_API( OSErr )
  478. GetMenuItemModifiers            (MenuHandle             inMenu,
  479.                                  SInt16                 inItem,
  480.                                  UInt8 *                outModifiers)                        THREEWORDINLINE(0x303C, 0x0505, 0xA825);
  481.  
  482. EXTERN_API( OSErr )
  483. SetMenuItemIconHandle            (MenuHandle             inMenu,
  484.                                  SInt16                 inItem,
  485.                                  UInt8                     inIconType,
  486.                                  Handle                 inIconHandle)                        THREEWORDINLINE(0x303C, 0x0606, 0xA825);
  487.  
  488. EXTERN_API( OSErr )
  489. GetMenuItemIconHandle            (MenuHandle             inMenu,
  490.                                  SInt16                 inItem,
  491.                                  UInt8 *                outIconType,
  492.                                  Handle *                outIconHandle)                        THREEWORDINLINE(0x303C, 0x0707, 0xA825);
  493.  
  494. EXTERN_API( OSErr )
  495. SetMenuItemTextEncoding            (MenuHandle             inMenu,
  496.                                  SInt16                 inItem,
  497.                                  TextEncoding             inScriptID)                            THREEWORDINLINE(0x303C, 0x0408, 0xA825);
  498.  
  499. EXTERN_API( OSErr )
  500. GetMenuItemTextEncoding            (MenuHandle             inMenu,
  501.                                  SInt16                 inItem,
  502.                                  TextEncoding *            outScriptID)                        THREEWORDINLINE(0x303C, 0x0509, 0xA825);
  503.  
  504. EXTERN_API( OSErr )
  505. SetMenuItemHierarchicalID        (MenuHandle             inMenu,
  506.                                  SInt16                 inItem,
  507.                                  SInt16                 inHierID)                            THREEWORDINLINE(0x303C, 0x040D, 0xA825);
  508.  
  509. EXTERN_API( OSErr )
  510. GetMenuItemHierarchicalID        (MenuHandle             inMenu,
  511.                                  SInt16                 inItem,
  512.                                  SInt16 *                outHierID)                            THREEWORDINLINE(0x303C, 0x050E, 0xA825);
  513.  
  514. EXTERN_API( OSErr )
  515. SetMenuItemFontID                (MenuHandle             inMenu,
  516.                                  SInt16                 inItem,
  517.                                  SInt16                 inFontID)                            THREEWORDINLINE(0x303C, 0x040F, 0xA825);
  518.  
  519. EXTERN_API( OSErr )
  520. GetMenuItemFontID                (MenuHandle             inMenu,
  521.                                  SInt16                 inItem,
  522.                                  SInt16 *                outFontID)                            THREEWORDINLINE(0x303C, 0x0510, 0xA825);
  523.  
  524. EXTERN_API( OSErr )
  525. SetMenuItemRefCon                (MenuHandle             inMenu,
  526.                                  SInt16                 inItem,
  527.                                  UInt32                 inRefCon)                            THREEWORDINLINE(0x303C, 0x050A, 0xA825);
  528.  
  529. EXTERN_API( OSErr )
  530. GetMenuItemRefCon                (MenuHandle             inMenu,
  531.                                  SInt16                 inItem,
  532.                                  UInt32 *                outRefCon)                            THREEWORDINLINE(0x303C, 0x050B, 0xA825);
  533.  
  534. EXTERN_API( OSErr )
  535. SetMenuItemRefCon2                (MenuHandle             inMenu,
  536.                                  SInt16                 inItem,
  537.                                  UInt32                 inRefCon2)                            THREEWORDINLINE(0x303C, 0x0511, 0xA825);
  538.  
  539. EXTERN_API( OSErr )
  540. GetMenuItemRefCon2                (MenuHandle             inMenu,
  541.                                  SInt16                 inItem,
  542.                                  UInt32 *                outRefCon2)                            THREEWORDINLINE(0x303C, 0x0512, 0xA825);
  543.  
  544. EXTERN_API( OSErr )
  545. SetMenuItemKeyGlyph                (MenuHandle             inMenu,
  546.                                  SInt16                 inItem,
  547.                                  SInt16                 inGlyph)                            THREEWORDINLINE(0x303C, 0x0513, 0xA825);
  548.  
  549. EXTERN_API( OSErr )
  550. GetMenuItemKeyGlyph                (MenuHandle             inMenu,
  551.                                  SInt16                 inItem,
  552.                                  SInt16 *                outGlyph)                            THREEWORDINLINE(0x303C, 0x0514, 0xA825);
  553.  
  554. /*——————————————————————————————————————————————————————————————————————————————————————*/
  555. /*    • Appearance 1.1 and later Menu Manager routines                                    */
  556. /*——————————————————————————————————————————————————————————————————————————————————————*/
  557. /*——————————————————————————————————————————————————————————————————————————————————————*/
  558. /* • Properties                                                                            */
  559. /*——————————————————————————————————————————————————————————————————————————————————————*/
  560. /* With the following property APIs, you can attach any piece of data you'd like to a    */
  561. /* menu or menu item. Passing zero for the item number parameter indicates you'd like    */
  562. /* to attach the data to the menu itself, and not to any specific menu item.            */
  563. EXTERN_API( OSStatus )
  564. GetMenuItemProperty                (MenuHandle             menu,
  565.                                  UInt16                 item,
  566.                                  OSType                 propertyCreator,
  567.                                  OSType                 propertyTag,
  568.                                  UInt32                 bufferSize,
  569.                                  UInt32 *                actualSize,
  570.                                  void *                    propertyBuffer);
  571.  
  572. EXTERN_API( OSStatus )
  573. GetMenuItemPropertySize            (MenuHandle             menu,
  574.                                  UInt16                 item,
  575.                                  OSType                 propertyCreator,
  576.                                  OSType                 propertyTag,
  577.                                  UInt32 *                size);
  578.  
  579. EXTERN_API( OSStatus )
  580. SetMenuItemProperty                (MenuHandle             menu,
  581.                                  UInt16                 item,
  582.                                  OSType                 propertyCreator,
  583.                                  OSType                 propertyTag,
  584.                                  UInt32                 propertySize,
  585.                                  void *                    propertyData);
  586.  
  587. EXTERN_API( OSStatus )
  588. RemoveMenuItemProperty            (MenuHandle             menu,
  589.                                  UInt16                 item,
  590.                                  OSType                 propertyCreator,
  591.                                  OSType                 propertyTag);
  592.  
  593.  
  594. /*——————————————————————————————————————————————————————————————————————————————————————*/
  595. /* • item enabling routines supporting > 31 items                                                                            */
  596. /*——————————————————————————————————————————————————————————————————————————————————————*/
  597. /* IsMenuItemEnabled works for items enabled with either Enable/DisableMenuItem and Enable/DisableItem*/
  598.  
  599. EXTERN_API( void )
  600. EnableMenuItem                    (MenuHandle             theMenu,
  601.                                  UInt16                 item);
  602.  
  603. EXTERN_API( void )
  604. DisableMenuItem                    (MenuHandle             theMenu,
  605.                                  UInt16                 item);
  606.  
  607. EXTERN_API( Boolean )
  608. IsMenuItemEnabled                (MenuHandle             menu,
  609.                                  UInt16                 item);
  610.  
  611. /*
  612.    item icon enabling routines allowing icons to be dimmed
  613.    the item’s main enable state itself does not change
  614.    if the item is disabled, the icon will appear to be disabled
  615. */
  616. EXTERN_API( void )
  617. EnableMenuItemIcon                (MenuHandle             theMenu,
  618.                                  UInt16                 item)                                THREEWORDINLINE(0x303C, 0x0019, 0xA825);
  619.  
  620. EXTERN_API( void )
  621. DisableMenuItemIcon                (MenuHandle             theMenu,
  622.                                  UInt16                 item)                                THREEWORDINLINE(0x303C, 0x0020, 0xA825);
  623.  
  624. EXTERN_API( Boolean )
  625. IsMenuItemIconEnabled            (MenuHandle             menu,
  626.                                  UInt16                 item)                                THREEWORDINLINE(0x303C, 0x0018, 0xA825);
  627.  
  628. /* menu bar visibility routines*/
  629. EXTERN_API( Boolean )
  630. IsMenuBarVisible                (void);
  631.  
  632. EXTERN_API( void )
  633. ShowMenuBar                        (void);
  634.  
  635. EXTERN_API( void )
  636. HideMenuBar                        (void);
  637.  
  638. /* AppendMenuItemText and InsertMenuItemText is used to add a single menu item     */
  639. /* without doing any meta-character interpretation */
  640. EXTERN_API( OSStatus )
  641. AppendMenuItemText                (MenuHandle             menu,
  642.                                  ConstStr255Param         inString);
  643.  
  644. EXTERN_API( OSStatus )
  645. InsertMenuItemText                (MenuHandle             menu,
  646.                                  ConstStr255Param         inString,
  647.                                  UInt16                 afterItem);
  648.  
  649. /* Get/SetMenuFont are used to save/restore the font used for drawing menus.    */
  650. EXTERN_API( OSStatus )
  651. GetMenuFont                        (MenuHandle             menu,
  652.                                  SInt16 *                outFontID,
  653.                                  UInt16 *                outFontSize);
  654.  
  655. EXTERN_API( OSStatus )
  656. SetMenuFont                        (MenuHandle             menu,
  657.                                  SInt16                 inFontID,
  658.                                  UInt16                 inFontSize);
  659.  
  660. /*——————————————————————————————————————————————————————————————————————————————————————*/
  661. /*    • Menu Width Modifiers                                                                */
  662. /*——————————————————————————————————————————————————————————————————————————————————————*/
  663. EXTERN_API( Boolean )
  664. GetMenuExcludesMarkColumn        (MenuHandle             menu);
  665.  
  666. EXTERN_API( OSStatus )
  667. SetMenuExcludesMarkColumn        (MenuHandle             menu,
  668.                                  Boolean                 excludesMark);
  669.  
  670. /*——————————————————————————————————————————————————————————————————————————————————————*/
  671. /*    • Contextual Menu routines and constants                                            */
  672. /*    available with Conxtextual Menu extension 1.0 and later                                */
  673. /*——————————————————————————————————————————————————————————————————————————————————————*/
  674. /* Gestalt Selector for classic 68K apps only. */
  675. /* CFM apps should weak link and check the symbols. */
  676.  
  677. enum {
  678.     gestaltContextualMenuAttr    = FOUR_CHAR_CODE('cmnu'),
  679.     gestaltContextualMenuUnusedBit = 0,
  680.     gestaltContextualMenuTrapAvailable = 1
  681. };
  682.  
  683. /* Values indicating what kind of help the application supports */
  684.  
  685. enum {
  686.     kCMHelpItemNoHelp            = 0,
  687.     kCMHelpItemAppleGuide        = 1,
  688.     kCMHelpItemOtherHelp        = 2
  689. };
  690.  
  691. /* Values indicating what was chosen from the menu */
  692.  
  693. enum {
  694.     kCMNothingSelected            = 0,
  695.     kCMMenuItemSelected            = 1,
  696.     kCMShowHelpSelected            = 3
  697. };
  698.  
  699. EXTERN_API( OSStatus )
  700. InitContextualMenus                (void)                                                        TWOWORDINLINE(0x7001, 0xAA72);
  701.  
  702. EXTERN_API( Boolean )
  703. IsShowContextualMenuClick        (const EventRecord *    inEvent)                            TWOWORDINLINE(0x7002, 0xAA72);
  704.  
  705. EXTERN_API( OSStatus )
  706. ContextualMenuSelect            (MenuHandle             inMenu,
  707.                                  Point                     inGlobalLocation,
  708.                                  Boolean                 inReserved,
  709.                                  UInt32                 inHelpType,
  710.                                  ConstStr255Param         inHelpItemString,
  711.                                  const AEDesc *            inSelection,
  712.                                  UInt32 *                outUserSelectionType,
  713.                                  SInt16 *                outMenuID,
  714.                                  UInt16 *                outMenuItem)                        TWOWORDINLINE(0x7003, 0xAA72);
  715.  
  716. EXTERN_API( Boolean )
  717. ProcessIsContextualMenuClient    (ProcessSerialNumber *    inPSN)                                TWOWORDINLINE(0x7004, 0xAA72);
  718.  
  719.  
  720.  
  721.  
  722. /* 
  723.     CheckItem, CountMItems, and SetMenuFlash should have better names.
  724.     But the shipping InterfaceLib has the old names, so we need
  725.     to define the new and old names and use macros to map the 
  726.     new names to old names for linking with InterfaceLib.
  727. */
  728. #if TARGET_OS_MAC
  729.     #define CheckMenuItem MacCheckMenuItem
  730. #endif
  731. #define MacCheckMenuItem( menu, item, checked ) CheckItem( menu, item, checked )
  732. #define CountMenuItems( menu )                     CountMItems( menu )
  733. #define SetMenuFlashCount( count )                 SetMenuFlash( count )
  734.  
  735.  
  736. #if CGLUESUPPORTED
  737. EXTERN_API_C( MenuHandle )
  738. newmenu                            (short                     menuID,
  739.                                  const char *            menuTitle);
  740.  
  741. EXTERN_API_C( void )
  742. appendmenu                        (MenuHandle             menu,
  743.                                  const char *            data);
  744.  
  745. EXTERN_API_C( void )
  746. insertmenuitem                    (MenuHandle             theMenu,
  747.                                  const char *            itemString,
  748.                                  short                     afterItem);
  749.  
  750. EXTERN_API_C( long )
  751. menuselect                        (const Point *            startPt);
  752.  
  753. EXTERN_API_C( void )
  754. setmenuitemtext                    (MenuHandle             menu,
  755.                                  short                     item,
  756.                                  const char *            itemString);
  757.  
  758. EXTERN_API_C( void )
  759. getmenuitemtext                    (MenuHandle             menu,
  760.                                  short                     item,
  761.                                  char *                    itemString);
  762.  
  763. #endif  /* CGLUESUPPORTED */
  764.  
  765. #if OLDROUTINENAMES
  766. #define AddResMenu(theMenu, theType) AppendResMenu(theMenu, theType)
  767. #define InsMenuItem(theMenu, itemString, afterItem)    InsertMenuItem(theMenu, itemString, afterItem)
  768. #define DelMenuItem( theMenu, item ) DeleteMenuItem( theMenu, item )
  769. #if TARGET_OS_MAC
  770. #define SetItem MacSetItem
  771. #define GetItem MacGetItem
  772. #endif
  773. #define MacSetItem(theMenu, item, itemString) SetMenuItemText(theMenu, item, itemString)
  774. #define MacGetItem(theMenu, item, itemString) GetMenuItemText(theMenu, item, itemString)
  775. #define GetMHandle(menuID) GetMenuHandle(menuID)
  776. #define DelMCEntries(menuID, menuItem) DeleteMCEntries(menuID, menuItem)
  777. #define DispMCInfo(menuCTbl) DisposeMCInfo(menuCTbl)
  778. #if CGLUESUPPORTED
  779. #define addresmenu(menu, data) appendresmenu(menu, data)
  780. #define getitem(menu, item, itemString) getmenuitemtext(menu, item, itemString)
  781. #define setitem(menu, item, itemString) setmenuitemtext(menu, item, itemString)
  782. #define insmenuitem(theMenu, itemString, afterItem)    insertmenuitem(theMenu, itemString, afterItem)
  783. #endif    /* CGLUESUPPORTED */
  784. #endif  /* OLDROUTINENAMES */
  785.  
  786.  
  787.  
  788. #if TARGET_OS_WIN32
  789. #endif  /* TARGET_OS_WIN32 */
  790.  
  791.  
  792. #if PRAGMA_STRUCT_ALIGN
  793.     #pragma options align=reset
  794. #elif PRAGMA_STRUCT_PACKPUSH
  795.     #pragma pack(pop)
  796. #elif PRAGMA_STRUCT_PACK
  797.     #pragma pack()
  798. #endif
  799.  
  800. #ifdef PRAGMA_IMPORT_OFF
  801. #pragma import off
  802. #elif PRAGMA_IMPORT
  803. #pragma import reset
  804. #endif
  805.  
  806. #ifdef __cplusplus
  807. }
  808. #endif
  809.  
  810. #endif /* __MENUS__ */
  811.  
  812.